package com.ie.controller.admin;

import com.ie.common.http.ResponseResult;
import com.ie.common.security.anno.AuthIgrone;
import com.ie.entity.GoodsEntity;
import com.ie.entity.OrdersEntity;
import com.ie.entity.getA110rdersEntity;
import com.ie.sevice.admin.getA110rdersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
 * @Description: TODO
 * @Author: xujia
 * @Date: 2024/9/10  23:02
 * @Param:
 * @version: 1.0
 * @Return:
 **/

@RestController
@RequestMapping("/api/admin/orders/getA110rders")
public class getA110rdersController {
    @Autowired
    private getA110rdersService getA110rdersService;
    private static String fileName;
    private static byte[] filecontent;

    @AuthIgrone
    @PostMapping("/fileInit")
    public void fileInit(@RequestBody MultipartFile file) {
        // MultipartFile对象不能在另一个方法中使用，所以把文件对象变成字节数组
        try {
            filecontent = file.getBytes();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        fileName = file.getOriginalFilename();
    }
    // 获取订单信息
    @AuthIgrone// TODO忽略权限
    @PostMapping("/getOrders")
    public ResponseResult<Map<String, Object>> getA110rders(@RequestBody OrdersEntity OrdersEntity) {
        return getA110rdersService.getA110rders(OrdersEntity);
    }

    // 用户id的获取
    @AuthIgrone//TODO    忽略权限
    @PostMapping("/getbusertableId")
    public ResponseResult<Map<String,Object>> getbusertableId(@RequestBody OrdersEntity ordersEntity) {
        return getA110rdersService.getbusertableId(ordersEntity);
    }
    //订单金额
    @AuthIgrone//TODO
    @PostMapping("/getamount")
    public ResponseResult<Map<String,Object>> getamount(@RequestBody OrdersEntity ordersEntity) {
        return getA110rdersService.getamount(ordersEntity);
    }
    //订单状态
    @AuthIgrone//TODO忽略权限
    @PostMapping("/getstatus")
    public ResponseResult<Map<String,Object>> getstatus(@RequestBody OrdersEntity ordersEntity) {
        return getA110rdersService.getstatus(ordersEntity);
    }
}
